<!--
	作者：Sariay
	时间：2018-09-25
	描述：There may be a bug, but don't worry, QiLing(器灵) says that it can work normally!
-->
<!DOCTYPE html>
<html class="html-loading">
		

<head><meta name="generator" content="Hexo 3.9.0">
	<meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
  <title>
    
      阅读统计功能 | 徐伟智
    
  </title>
  <meta name="author" content="徐伟智">
  <meta name="keywords" content>
  <meta name="description" content="个人博客">
	<!-- favicon -->
  <link rel="shortcut icon" href="/img/favicon.ico">

  <!-- css -->
  <link rel="stylesheet" href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="/css/Annie.css">
  
  <!-- jquery -->
	<script src="/js/jquery.min.js"></script>

  <!-- leancloud -->
  <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.4.js"></script>
<script src="/js/leancloud.js"></script>
</head>
	<body>
		<!-- Preloader -->

	<div id="preloader">
		<div class="pre-container">
			
				<div class="transition">
					<div class="three-bounce1"></div>
					<div class="three-bounce2"></div>
					<div class="three-bounce3"></div>
				</div>
						
		</div>
	</div>


<!-- header -->
<header class="fixbackground" data-img-mode="normal" data-normal-src="/img/1.jpg" data-random-max="110" data-random-src="https://sariay.github.io/Random-img/">
	<div class="mask">
		<!-- Logo and navigation -->
		<div class="h-header">
			<div id="logo">
				<a href="/">
						
						<img src="/img/logo.png" alt="Logo">
					
				</a>
			</div>
			
			<div id="navigation-show">
				<ul>
	
		<li class="menu-home">
			<a href="/" class="menu-item-home">主页</a>
		</li>
	
		<li class="menu-archive">
			<a href="/archives" class="menu-item-archive">归档</a>
		</li>
	
		<li class="menu-categories">
			<a href="/categories" class="menu-item-categories">分类</a>
		</li>
	
		<li class="menu-tags">
			<a href="/tags" class="menu-item-tags">标签</a>
		</li>
	
		<li class="menu-about">
			<a href="/about" class="menu-item-about">关于</a>
		</li>
	
		<li class="menu-gallery">
			<a href="/gallery" class="menu-item-gallery">相册</a>
		</li>
	

	
		<li class="menu-search">
			<a href="javascript:;" class="popup-trigger">搜索</a>
		</li>
	
</ul>
			</div>				
		</div>

		<!-- motto -->
		<div class="h-body">	
			
				<p class="motto"></p>
			
		</div>
		
		<!-- others: such as time... -->			
		<div class="h-footer">
			<a href="javascript:;" id="read-more"><i class="fa fa-angle-double-down" aria-hidden="true"></i>
			</a>

			
				<!-- 
	This is only a demo, please go to "https://time.is" to set your city time! 
-->
<style type="text/css">
	.header-date {
		font-size: 1.6rem;
		color: #fff;
		position: absolute;
		bottom: 5px;
		right: 1rem;
		writing-mode: tb-rl;
	}	
	
	.header-date a {
		border-bottom: none;
	}

	@media only screen and (max-width: 768 ) {
		.header-date {
			font-size: 1rem;
		}			
	}
</style>
<div class="header-date">
	<a href="https://time.is/Beijing" id="time_is_link" rel="nofollow" ></a>
	<span id="Beijing_z43d"></span>
</div>
<script src="//widget.time.is/zh.js"></script>
<script>
	time_is_widget.init({
		Beijing_z43d:{
			template:"DATE", 
			date_format:"year年 monthname dnum日"
		}
	});
</script>
			
		</div>
	</div>
</header>

<div id="navigation-hide">
	<!-- Progress bar -->
	<div id="progress-bar"></div>

	<!-- Progress percent -->
	<div id="progress-percentage"><h1>0.0%</h1></div>

	<div class="toc-switch"><span class="switch-button">目录</span></div>

	<!-- Page title -->
	<p>
		
			当前文章&nbsp;:&nbsp;《阅读统计功能》
		
	</p>

	<!-- Nav trigger for navigation-H-->
	<a class="nav-trigger"><span></span></a>
</div>

<!-- Navigation in div(id="navigation-H") -->
<nav class="nav-container" id="cd-nav">
	<div class="nav-header">
		<h3>Navigation</h3>
		<a href="javascript:;" class="nav-close"></a>
	</div>
	<div class="nav-body">
		<ul>
	
		<li class="menu-home">
			<a href="/" class="menu-item-home">主页</a>
		</li>
	
		<li class="menu-archive">
			<a href="/archives" class="menu-item-archive">归档</a>
		</li>
	
		<li class="menu-categories">
			<a href="/categories" class="menu-item-categories">分类</a>
		</li>
	
		<li class="menu-tags">
			<a href="/tags" class="menu-item-tags">标签</a>
		</li>
	
		<li class="menu-about">
			<a href="/about" class="menu-item-about">关于</a>
		</li>
	
		<li class="menu-gallery">
			<a href="/gallery" class="menu-item-gallery">相册</a>
		</li>
	

	
		<li class="menu-search">
			<a href="javascript:;" class="popup-trigger">搜索</a>
		</li>
	
</ul>
	</div>
	<div class="nav-footer">
		<ul>
	
		<li>
			<a href="http://github.com/xwzl" target="_blank">
				<i class="fa fa-github"></i>
			</a>
		</li>
	
		<li>
			<a href="http://github.com/xwz" target="_blank">
				<i class="fa fa-weibo"></i>
			</a>
		</li>
	
		<li>
			<a href="http://github.com/xwz" target="_blank">
				<i class="fa fa-pinterest"></i>
			</a>
		</li>
	
		<li>
			<a href="http://github.com/xwz" target="_blank">
				<i class="fa fa-instagram"></i>
			</a>
		</li>
	
		<li>
			<a href="http://github.com/xwz" target="_blank">
				<i class="fa fa-twitter"></i>
			</a>
		</li>
	
		<li>
			<a href="/atom.xml" target="_blank">
				<i class="fa fa-rss"></i>
			</a>
		</li>
			
</ul>

	</div>
</nav>
			
		<!--main-->
		<main>
			<!--
	时间：2018-11-17
	描述：
		插件名称：katelog.min.js
		插件作者：KELEN
		插件来源: https://github.com/KELEN/katelog
-->

	
		<div class="layout-toc">
			<div id="layout-toc">
				<div class="k-catelog-list" id="catelog-list" data-title="文章目录"></div>
			</div>
		</div>

		
		<script src="/plugin/toc/katelog.min.js"></script>

		
	 

<div class="layout-post">
	<div id="layout-post">
	<div class="article-title">
		<i class="fa fa-paper-plane-o" aria-hidden="true"></i>
		
	<a href="/Annie/hexo/hexo-view/" itemprop="url">
		阅读统计功能
	</a>

	</div>

	<div class="article-meta">
		<span>
			<i class="fa fa-calendar"></i>
			


	发布于

	<a href="/Annie/hexo/hexo-view/" itemprop="url">
		<time datetime="2019-10-15T03:41:00.000Z" itemprop="datePublished">
	  		2019-10-15
	  </time>
	</a>
	&nbsp;





			




	更新于

	<a href="/Annie/hexo/hexo-view/" itemprop="url">
		<time datetime="2019-10-15T03:41:00.000Z" itemprop="dateUpdated">
	  		2019-10-18
	  </time>
	</a> 



		</span>
		<span>
			<i class="fa fa-tags"></i>
			
	
		<a href="/tags/Annie/" class=" ">
			Annie
		</a>
	
		
		</span>
		
		

	
    <span class="leancloud_visitors" id="/Annie/hexo/hexo-view/_visitors" data-url="/Annie/hexo/hexo-view/" data-title="阅读统计功能">
       	<i class="fa fa-eye"></i>
       	热度
        <i class="leancloud_visitors_count" id="leancloud_visitors_count">0</i>
    </span>
    



	
    <span class="leancloud_likes" id="/Annie/hexo/hexo-view/_likes" data-url="/Annie/hexo/hexo-view/" data-title="阅读统计功能" rel="unlike">
        <i class="fa fa-heart"></i>
        喜欢
        <i class="leancloud_likes_count" id="leancloud_likes_count">0</i>
    </span>

	</div>

	<div class="article-content" id="article-content">
		<p>关于添加文章阅读量统计功能，大家一般采用不蒜子进行统计，因为植入比较简单。</p>
<p>我采用的是LeanCloud。LeanCloud的官方网址：<a href="https://leancloud.cn/" target="_blank" rel="noopener">https://leancloud.cn/</a></p>
<h3 id="1-注册创建应用"><a href="#1-注册创建应用" class="headerlink" title="1.注册创建应用"></a>1.注册创建应用</h3><p>首先进行注册，注册时如果密码过于简单会有提示，但是没有提示密码最低要求。我试了下，数字加大小写字母组合可以完成注册。</p>
<p>注册完成后，访问工作台创建一款新的移动应用，如下图所示：</p>
<p><img src="/img/hexo/2019-10-15-5.png" alt="111"></p>
<h3 id="2-配置LeanCloud"><a href="#2-配置LeanCloud" class="headerlink" title="2.配置LeanCloud"></a>2.配置LeanCloud</h3><p>进入新创建好的应用，点击存储，这时需要创建名为Counter的class用来存储访问博客的数据，例如：访问次数，最新访问时间等信息。class类名必须为Counter，主要为了与next主题相兼容，否则无法接收到相关数据。为了避免后续因为权限的问题导致次数统计显示不正常，ACL权限选择无限制，具体配置如下图所示：</p>
<p><img src="/img/hexo/2019-10-15-6.png" alt="111"></p>
<p>在所有应用中获取当前新建应用的app_id和app_key，我把我的信息注释掉了，不要误会，如下图所示：</p>
<p><img src="/img/hexo/2019-10-15-7.png" alt="111"></p>
<p>修改博客根目录-&gt;themes-&gt;next-&gt;_config.yml文件，app_id和app_key是上图获取到的，找到如下代码替换app_id和app_key并将enable改为true，代码如下：</p>
<pre><code># Show number of visitors to each article.
# You can visit https://leancloud.cn get AppID and AppKey.
leancloud_visitors:
enable: true
app_id: #AppID
app_key: #AppKey</code></pre><p>配置完成后生成部署hexo博客即可</p>
<pre><code>hexo generate
hexo deploy</code></pre><p>参考资料：</p>
<p><a href="https://notes.wanghao.work/2015-10-21-%E4%B8%BANexT%E4%B8%BB%E9%A2%98%E6%B7%BB%E5%8A%A0%E6%96%87%E7%AB%A0%E9%98%85%E8%AF%BB%E9%87%8F%E7%BB%9F%E8%AE%A1%E5%8A%9F%E8%83%BD.html" target="_blank" rel="noopener">https://notes.wanghao.work/2015-10-21-%E4%B8%BANexT%E4%B8%BB%E9%A2%98%E6%B7%BB%E5%8A%A0%E6%96%87%E7%AB%A0%E9%98%85%E8%AF%BB%E9%87%8F%E7%BB%9F%E8%AE%A1%E5%8A%9F%E8%83%BD.html</a></p>
	
	</div>
	
	<div id="current-post-cover" data-scr="/img/1.jpg"></div>

	<!-- relate post, comment...-->
	<div class="investment-container">
		<div class="investment-header">
			<div class="investment-title-1">
				<div class="on">相关文章</div>
				<div>评论</div>
				<div>分享</div>
			</div>
			<div class="investment-title-2">	            
				
	<span>
		<a href="javascript: window.scrollTo(0, 0);">返回顶部</a>
		
			<a href="/linux/linux/git/git -- branch/" title="git 分支（零）" rel="prev">
				&laquo;上一篇
			</a>
		
		
			<a href="/Annie/hexo/git_talk/" title="Annie主题使用 Gitalk" rel="next">
				下一篇&raquo;
			</a>
			
	</span>


      		
			</div>	
		</div>
		
		<div class="investment-content">
			<div class="investment-content-list">
				

<div class="relate-post">
	
		<ul>
			
					<li>
						<div class="relate-post-text">
							<a class="relate-post-title" href="/Annie/hexo/git_talk/" title="Annie主题使用 Gitalk">
								Annie主题使用 Gitalk			
							</a>
							<p class="relate-post-date">
								<i class="fa fa-calendar"></i>
								十月 15日, 2019				
							</p>
							<p class="relate-post-content">
								Gitalk使用方法Gitalk使用方法一新建仓库
点击你的用户名，定位到github用户主页，新建一个仓库


#点击New之后，你应该看到

注册应用Gitalk评论插件的授权机制依赖于OAuth Application，故使用G...
							</p>
						</div>

						<div class="relate-post-cover">
							<a href="/Annie/hexo/git_talk/" title="Annie主题使用 Gitalk">				
								
								<img class="lazy" src="/img/placeholder.jpg" data-src="/img/1.jpg" alt="Annie主题使用 Gitalk"/>
							</a>
						</div>
					</li>											
			
			
					<li>
						<div class="relate-post-text">
							<a class="relate-post-title" href="/Annie/hexo/annie_hexo/" title="Annie主题使用说明">
								Annie主题使用说明			
							</a>
							<p class="relate-post-date">
								<i class="fa fa-calendar"></i>
								十月 14日, 2019				
							</p>
							<p class="relate-post-content">
								零、准备工作开始之前，你应该预先理解下列标签的意义：
0.1 代码对比
123  This is a diff block.+ This is add!- This is subtract!

0.2 信息提示
!!!info    ...
							</p>
						</div>

						<div class="relate-post-cover">
							<a href="/Annie/hexo/annie_hexo/" title="Annie主题使用说明">				
								
								<img class="lazy" src="/img/placeholder.jpg" data-src="/img/1.jpg" alt="Annie主题使用说明"/>
							</a>
						</div>
					</li>											
			
			
					<li>
						<div class="relate-post-text">
							<a class="relate-post-title" href="/tool/tool/idea/idea-linux/" title="IntelliJ 连接 linux">
								IntelliJ 连接 linux			
							</a>
							<p class="relate-post-date">
								<i class="fa fa-calendar"></i>
								十月 21日, 2019				
							</p>
							<p class="relate-post-content">
								打开远程配置中心
新建 SFTP 服务
配置连接
配置文件映射路径
打开

							</p>
						</div>

						<div class="relate-post-cover">
							<a href="/tool/tool/idea/idea-linux/" title="IntelliJ 连接 linux">				
								
								<img class="lazy" src="/img/placeholder.jpg" data-src="/img/1.jpg" alt="IntelliJ 连接 linux"/>
							</a>
						</div>
					</li>											
			
			
					<li>
						<div class="relate-post-text">
							<a class="relate-post-title" href="/python/pyhton/parameter_passing/" title="Python函数参数传递机制">
								Python函数参数传递机制			
							</a>
							<p class="relate-post-date">
								<i class="fa fa-calendar"></i>
								十月 20日, 2019				
							</p>
							<p class="relate-post-content">
								Python中，函数参数由实参传递给形参的过程，是由参数传递机制来控制的。通过学习《Python函数值传递和引用传递》一节我们知道，根据实际参数的类型不同，函数参数的传递方式分为值传递和引用传递（又称为地址传递），本节将对这两种传递机...
							</p>
						</div>

						<div class="relate-post-cover">
							<a href="/python/pyhton/parameter_passing/" title="Python函数参数传递机制">				
								
								<img class="lazy" src="/img/placeholder.jpg" data-src="/img/1.jpg" alt="Python函数参数传递机制"/>
							</a>
						</div>
					</li>											
			
			
					<li>
						<div class="relate-post-text">
							<a class="relate-post-title" href="/tool/tool/idea/idea-plugins/" title="IntelliJ IDEA 插件">
								IntelliJ IDEA 插件			
							</a>
							<p class="relate-post-date">
								<i class="fa fa-calendar"></i>
								十月 16日, 2019				
							</p>
							<p class="relate-post-content">
								Idea J 插件WireMock 伪造 Restful 风格的 API http://wiremock.org/docs/running-standalone/
关闭代码自动补全

lombok
Key Promoter X
Jre...
							</p>
						</div>

						<div class="relate-post-cover">
							<a href="/tool/tool/idea/idea-plugins/" title="IntelliJ IDEA 插件">				
								
								<img class="lazy" src="/img/placeholder.jpg" data-src="/img/1.jpg" alt="IntelliJ IDEA 插件"/>
							</a>
						</div>
					</li>											
			
			
					<li>
						<div class="relate-post-text">
							<a class="relate-post-title" href="/tool/tool/idea/idea-skills/" title="IntelliJ IDEA 超实用使用技巧分享">
								IntelliJ IDEA 超实用使用技巧分享			
							</a>
							<p class="relate-post-date">
								<i class="fa fa-calendar"></i>
								十月 16日, 2019				
							</p>
							<p class="relate-post-content">
								日常使用 必备快捷键（★★）查找


快捷键
介绍



Ctrl + F
在当前文件进行文本查找


Ctrl + R
在当前文件进行文本替换


Shift + Ctrl + F
在项目就进行文本查找


Shift + Ctrl...
							</p>
						</div>

						<div class="relate-post-cover">
							<a href="/tool/tool/idea/idea-skills/" title="IntelliJ IDEA 超实用使用技巧分享">				
								
								<img class="lazy" src="/img/placeholder.jpg" data-src="/img/1.jpg" alt="IntelliJ IDEA 超实用使用技巧分享"/>
							</a>
						</div>
					</li>											
			
			
					<li>
						<div class="relate-post-text">
							<a class="relate-post-title" href="/linux/linux/git/git -- branch/" title="git 分支（零）">
								git 分支（零）			
							</a>
							<p class="relate-post-date">
								<i class="fa fa-calendar"></i>
								十月 15日, 2019				
							</p>
							<p class="relate-post-content">
								1.gitignore忽略项目中的某些文件，vi .gitignore 可创建文件 进去后:wq，向文件写入忽略的配合文件信息。
比如setting.proterties,在此提交的时候，就会被忽略掉；*.txt忽略txt为后缀的文件...
							</p>
						</div>

						<div class="relate-post-cover">
							<a href="/linux/linux/git/git -- branch/" title="git 分支（零）">				
								
								<img class="lazy" src="/img/placeholder.jpg" data-src="/img/1.jpg" alt="git 分支（零）"/>
							</a>
						</div>
					</li>											
			
			
					<li>
						<div class="relate-post-text">
							<a class="relate-post-title" href="/linux/linux/git/git -- zero/" title="git 基本概念（零）">
								git 基本概念（零）			
							</a>
							<p class="relate-post-date">
								<i class="fa fa-calendar"></i>
								十月 15日, 2019				
							</p>
							<p class="relate-post-content">
								工作区，暂存区，版本库的文件 区分三者关系

Git最让你迷惑的无非是它里面的各种概念了，如果是刚开始接触Git希望看完本篇介绍之后有一个清晰的认识，笔者认识也有限这里只说说个人对使用Git的感受，说一下它里面的几个最常用的概念的理解...
							</p>
						</div>

						<div class="relate-post-cover">
							<a href="/linux/linux/git/git -- zero/" title="git 基本概念（零）">				
								
								<img class="lazy" src="/img/placeholder.jpg" data-src="/img/1.jpg" alt="git 基本概念（零）"/>
							</a>
						</div>
					</li>											
			
			
					<li>
						<div class="relate-post-text">
							<a class="relate-post-title" href="/linux/linux/git/git -- one/" title="git 基本操作（一）">
								git 基本操作（一）			
							</a>
							<p class="relate-post-date">
								<i class="fa fa-calendar"></i>
								十月 15日, 2019				
							</p>
							<p class="relate-post-content">
								1.文件状态对于user.name与user.email来说，有三个地方可以设置
123456789101112131415git config --global --unset user.name 删除信息git config --...
							</p>
						</div>

						<div class="relate-post-cover">
							<a href="/linux/linux/git/git -- one/" title="git 基本操作（一）">				
								
								<img class="lazy" src="/img/placeholder.jpg" data-src="/img/1.jpg" alt="git 基本操作（一）"/>
							</a>
						</div>
					</li>											
			
			
		</ul>
	
</div>	
			</div>
			<div class="investment-content-list">
				<div class="layout-comment">

	

		

			<!-- gitalk comment -->
			<!-- show gitalk comment -->
<div id="gitalk-container"></div>

<!-- gitalk`s css & js -->
<link rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css">
<link rel="stylesheet" href="/css/comment.css">
<script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.min.js"></script>
<script src="https://unpkg.com/gitalk/dist/gitalk.min.js"></script>

<script type="text/javascript">
	//Thanks O-R
	//https://github.com/gitalk/gitalk/issues/102#issuecomment-382970552
	//去除尾部匹配正则数组的字符串  
	//Remove redundant characters
	String.prototype.trimEnd = function(regStr) {
		var result = this;
		if(regStr == undefined || regStr == null || regStr == "") {
			return result;
		}
		var array = regStr.split(',');

		if(array.length > 0) {

			var c = array.shift();
			var str = this;
			var i = str.length;
			var rg = new RegExp(c);
			var matchArr = str.match(rg);

			if(matchArr != undefined && matchArr != null && matchArr.length > 0) {
				var matchStr = matchArr[0].replace(/\\/g, "\\\\").replace(/\*/g, "\\*")
					.replace(/\+/g, "\\+").replace(/\|/g, "\\|")
					.replace(/\{/g, "\\{").replace(/\}/g, "\\}")
					.replace(/\(/g, "\\(").replace(/\)/g, "\\)")
					.replace(/\^/g, "\\^").replace(/\$/g, "\\$")
					.replace(/\[/g, "\\[").replace(/\]/g, "\\]")
					.replace(/\?/g, "\\?").replace(/\,/g, "\\,")
					.replace(/\./g, "\\.").replace(/\&/g, "\\&");
				matchStr = matchStr + '$';
				result = str.replace(new RegExp(matchStr), "");
			}

			if(array.length > 0) {
				return result.trimEnd(array.join())
			} else {
				return result;
			}
		}
	};

	//Create gitalk
	var gitalk = new Gitalk({
		clientID: '5061624e87004cfaa888',
		clientSecret: 'd1b215404379615b88f7cdf12059f751571a7aa5',
		//id: window.location.pathname,
		//id: decodeURI(window.location.pathname),
		//id: (window.location.pathname).split("/").pop().substring(0, 49),
		id: decodeURI( md5( location.href.trimEnd('#.*$,\\?.*$,index.html$') ) ),
		repo: 'spring-cloud',
		owner: 'xwzl',
		admin: 'xwzl',
		distractionFreeMode: 'true',
	})
	gitalk.render('gitalk-container');
</script>

		
		
	

</div>
			</div>
			<div class="investment-content-list">
				<div class="layout-share">
	
	

		
			
			<!-- socialShare share -->
			<div class="social-share"></div>

<!--  css & js -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/css/share.min.css">
<script async src="https://cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/js/social-share.min.js"></script>
			
		
		
	
</div>


			</div>
		</div>	
	</div>
	</div>
</div>



	<!-- leancloud -->
	<!--
	时间：2018-11-27
	描述：
		文章访问量：visitors
		文章喜欢量：likes	
		文章排行榜：topNPost
		其他得说明：
			01-Cookie相关的函数 
				https://blog.csdn.net/somehow1002/article/details/78511541（Author：somehow1002）
			02-visitors相关的函数 
				https://blog.csdn.net/u013553529/article/details/63357382（Author：爱博客大伯）
				https://notes.doublemine.me/2015-10-21-为NexT主题添加文章阅读量统计功能.html（Author：夏末）
			03-topNPost相关的函数
				https://hoxis.github.io/hexo-next-read-rank.html（Author：hoxis）
			04-likes相关的函数，
				参考了01 & 02进行简单的设计与实现
-->



	<script>
		var appid = 't3vujAbub7brF2u2FO3UT0sJ-gzGzoHsz',
            appkey = 'y4AQetmOEEwDkd3CEbXKX4nA';	  
        AnnieLeancloud(appid, appkey);         
	</script>
    

	


<!-- show math formula -->



	 
	<script src="/plugin/clipboard/clipboard.js"></script>
	<script>
		// Copy code !
	    function codePreprocessing() {
	        $("#article-content .highlight").each(function() {

	            $(this).wrap('<div id="post-code"></div>');

	        })

	        $("#article-content #post-code").each(function() {

	            $(this).prepend('<nav class="copy-nav"><span><i class="code-language"></i></span></nav>');

	        })

	        $("#article-content .copy-nav").each(function() {
	            var temp = $(this).next().attr('class'),
	                language = ((temp.length > 9) && (temp != null)) ? temp.substr(10) : "none"; //why 9? Need to check language?

	            $(this).find('.code-language').text(language);

	            $(this).append('<span class="copy-btn"><i class="fa fa-copy" aria-hidden="true"></i></span>');

	        });
	    }

		function codeCopy() {
		    $('#article-content #post-code').each(function(i) {
		        var codeCopyId = 'codeCopy-' + i;

		        var codeNode = $(this).find('.code'),
		            copyButton = $(this).find('.copy-btn');

		        codeNode.attr('id', codeCopyId);
		        copyButton.attr('data-clipboard-target-id', codeCopyId);
		    })

		    
			var clipboard = new ClipboardJS('.copy-btn', {
					target: function(trigger) {
						return document.getElementById(trigger.getAttribute('data-clipboard-target-id'));
					}
		      	});

			//pure js
			function showTooltip(elem, msg) {		   
				elem.setAttribute('aria-label', msg);
				elem.setAttribute('class', 'copy-btn copy-status');
				setTimeout(function() {
					elem.setAttribute('class', 'copy-btn');
				}, 2000);
			}

			clipboard.on('success', function(e) {
			    e.clearSelection();
			    console.info('Action:', e.action);		   
			    console.info('Trigger:', e.trigger);
			    showTooltip(e.trigger, 'Copied!');
			    
			});
			clipboard.on('error', function(e) {
			    console.error('Action:', e.action);
			    console.error('Trigger:', e.trigger);
			});
		

		}

		if ($('.layout-post').length) {
		    codePreprocessing();
		    codeCopy();
		} 
	</script>





<link rel="stylesheet" href="/plugin/fancybox/jquery.fancybox.css">
<script src="/plugin/fancybox/jquery.fancybox.js"></script>

<script type="text/javascript">
	var titleID = $('.article-title a'),
		imageID = $('.article-content img'),
		videoID = $('.article-content video');

	var postTitle = titleID.text() ? titleID.text() : "No post title!";

	imageID.each(function() {
		var imgPath = $(this).attr('src'),
			imgTitle = $(this).attr('alt') ? $(this).attr('alt') : "No image description!";

		//给每个匹配的<img>元素打包, 即添加父元素<a>
		$(this).wrap('<a data-fancybox="gallery" data-caption=" 《 ' + postTitle + ' 》 ' + imgTitle + ' "  href=" ' + imgPath + ' "> </a>');
	});

	videoID.each(function() {
		var videoPath = $(this).attr('src');

		//给每个匹配的<img>元素打包, 即添加父元素<a>
		$(this).wrap('<a data-fancybox href=" ' + videoPath + ' "> </a>');
	});
	//TODO：支持html5 video

	if($('#layout-post').length) {
		$('[data-fancybox="gallery"]').fancybox({
			loop: true,
			buttons: [
				"zoom",
				"share",
				"slideShow",
				"fullScreen",
				//"download",
				"thumbs",
				"close"
			],
			protect: false
		});
	}
</script>
		</main>

		<!--footer-->
		<footer>
	<div class="social">
		<ul>
	
		<li>
			<a href="http://github.com/xwzl" target="_blank">
				<i class="fa fa-github"></i>
			</a>
		</li>
	
		<li>
			<a href="http://github.com/xwz" target="_blank">
				<i class="fa fa-weibo"></i>
			</a>
		</li>
	
		<li>
			<a href="http://github.com/xwz" target="_blank">
				<i class="fa fa-pinterest"></i>
			</a>
		</li>
	
		<li>
			<a href="http://github.com/xwz" target="_blank">
				<i class="fa fa-instagram"></i>
			</a>
		</li>
	
		<li>
			<a href="http://github.com/xwz" target="_blank">
				<i class="fa fa-twitter"></i>
			</a>
		</li>
	
		<li>
			<a href="/atom.xml" target="_blank">
				<i class="fa fa-rss"></i>
			</a>
		</li>
			
</ul>

	</div>
		
	<div class="copyright">
		<p>
			 
				&copy;2019, content by 徐伟智. All Rights Reserved.
			
			
			

	<!-- busuanzi -->
	<!-- busuanzi -->

		
	<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
	

		<span id="busuanzi_container_page_pv">
	  		本文总阅读量<span id="busuanzi_value_page_pv"></span>次
		</span>

	




		</p>
		<p>
			<a href="http://hexo.io/" title="Hexo" target="_blank" rel="noopener">Hexo</a> Theme <a href="https://github.com/Sariay/hexo-theme-Annie" title="Annie" target="_blank" rel="noopener">Annie</a> by Sariay.
			<a href="javascript:zh_tran('s');" class="zh_click" id="zh_click_s">简体</a> 
			<a href="javascript:zh_tran('t');" class="zh_click" id="zh_click_t">繁體</a>				
		</p>
	</div>		
</footer>
		
	<!-- set '1' to show motto in all pages! -->

	<script src="/plugin/motto/motto.js"></script>
	
	<script type="text/javascript">
		$(".motto").html( getMingYanContent() );
	</script>	




	<!--
	时间：2018-10-3
	描述：
		插件名称：hexo-generator-search-zip
		插件来源: https://github.com/SuperKieran/hexo-generator-search-zip
		代码参考：https://github.com/SuperKieran/TKL/blob/master/layout/_partial/search.ejs(Include: js & css)	
-->
<div class="popup search-popup local-search-popup" >
	<div class="local-search-container">
		<span class="popup-btn-close">
      		ESC
   		</span>
		<div class="local-search-header">
			<div class="input-prompt">				
			</div>
			<input autocomplete="off" placeholder="Search..." type="text" id="local-search-input">
		</div>
		<div class="local-search-body">
			<div id="local-search-output"></div>
		</div>
		<div class="local-search-footer">
			<div class="topN-post">				
				

   
	<div id="topN">
		<div class="topN-title" data-title= "热门文章"></div> 
	</div>
	
    <script>
        var appid = 't3vujAbub7brF2u2FO3UT0sJ-gzGzoHsz',
            appkey = 'y4AQetmOEEwDkd3CEbXKX4nA',
            limitCount = 10;
        if( $('#topN').length ){
            AV.initialize(appid, appkey);
            var Counter = AV.Object.extend("Counter");  
            topNPost(Counter, limitCount);
        }
    </script>
   
								
			</div>
		</div>
	</div>
</div>

<script src="/plugin/search/ziploader.js"></script>
<script src="/plugin/search/search.js"></script>

<script type="text/javascript">
	var search_path = 'search.json',
		zip_Path = '/search.zip',
		version_Path = '/searchVersion.txt',
		input_Trigger = 'auto',
		top_N = '2';

	themeLocalSearch({
		search_path, 
		zip_Path, 
		version_Path, 
		input_Trigger, 
		top_N
	});
</script>


<!-- love effect -->

	<script src="/plugin/love/love.js"></script>


<!-- back to top -->

	
	<div id="totop">
  		<a href="javascript:;"  name="TOTOP" class="fa fa-arrow-up" ></a>
	</div>




<!-- site analysis -->


	<!-- site-analysis -->
	

	
	
	
	
 

<script src="/plugin/vibrant/vibrant.js"></script>
<script src="/plugin/chinese/chinese.js"></script>
<script src="/plugin/imgLazyLoader/yall.min.js"></script>
<script src="/plugin/imgResize/jquery.resizeimagetoparent.min.js"></script>
<script src="/plugin/nicescroll/jquery.nicescroll.js"></script>
<script src="/js/resizediv.js"></script>
<script src="/js/main.js"></script>
	</body>	
</html>